package com.zsk.okhttp;

import okhttp3.OkHttpClient;

/**
 * OkHttpClient is thread safe，It is better to set global uniqueness.As a
 * result, HTTP instances can be used globally
 * 
 * @author zhangsike
 * @date 2020-04-16 20:27:01
 */
public class Http implements IHttp {

	private OkHttpClient client;

	public Http(OkHttpClient client) {
		super();
		this.client = client;
	}

	public static Http of(boolean ignoreSSL) {
		return new Http(HttpFactory.newOkHttpClient(ignoreSSL));

	}

	@Override
	public IGetTask get(String url) {
		return new GetTask(client, url);
	};

	@Override
	public IPostTask post(String url) {
		return new PostTask(client, url);
	}

}
